<%@ page import="ro.gateway.aida.sectors.SectorWrapper,
                 ro.gateway.aida.sectors.SectorForm"%>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
<%@ taglib uri="/WEB-INF/translator.tld" prefix="trans" %><head>
<trans:initPage module="findsec" />
<link rel="stylesheet" href="<html:rewrite page="/alf.css" />" type="text/css">

<logic:present name="sector_form" property="sector">
      <bean:define id="sector" name="sector_form" property="sector"
            type="ro.gateway.aida.obj.AIDASector" />
      <logic:present name="sector" property="parent">
            <bean:define id="parent_sector" name="sector" property="parent" type="ro.gateway.aida.obj.AIDASector" />
      </logic:present>
</logic:present>
<%
      SectorForm form = ( SectorForm ) session.getAttribute("sector_form");
%>
<html:html>
<head>
      <script language="javascript">
            function make_layer_visible(layer) {
                  layer = document.getElementById(layer);
                  if (!layer) return;

                  if (layer.style) {
                        layer.style['visibility'] = 'visible';
                  } else {
                        layer.visibility = 'visible';
                  }
            }
      </script>
</head>
<body bgcolor="#FFFFFF" text="#000000">

<div id="loading" style="position: relative;visibility: hidden;height:50px;width:50%;left: 25%;top:5%;text-align: center;vertical-align: middle;border: 1px dotted;background-color: #f2f2f2;" class="text_searchbold"> 
  <br>
  Loading...<br>
  Please wait<br>
</div>

      <html:form action="/sectors/editor">
      <html:hidden property="event" />
      <html:hidden property="action" />
      <table width="90%" border="0" cellspacing="1" cellpadding="5" align="center" bgcolor="#3399CC" class="text">
            <tr bgcolor="#3399CC">
                  <td class="textalb" colspan="2">
                  <trans:showPageMessage label="findsec.sectoreditor" />
                  </td>
            </tr>

            <logic:present name="sector_form" property="parentsName" >
            <tr bgcolor="#FFFFFF">
                  <td align="right"><trans:showPageMessage label="findsec.parentsector" />:</td>
                  <td>
                  <bean:write name="sector_form" property="parentsName"/>
                  </td>
            </tr>
            </logic:present>

            <logic:present name="errors">
            <tr bgcolor="#FFFFFF">
                  <td colspan="2">
                  <trans:showPageMessage label="findsec.errors" />:<br>
                  <logic:iterate id="error" name="errors">
                    <trans:showPageMessage label='<%=(String)error%>' /><br>
                  </logic:iterate>
                  </td>
            </tr>
            </logic:present>

            <tr bgcolor="#FFFFFF">
                  <td align="right"><trans:showPageMessage label="findsec.name" />:</td>
                  <td>
                  <logic:present name="sector_form" property="avail_langs">
                        <select name="lang">
                        <logic:iterate id="langi" name="sector_form" property="avail_langs">
                              <%String[] lang = ( String[] ) langi;%>
                              <option <%=form.lang.equals(lang[0]) ? "selected=\"true\" " : ""%>value="<%=lang[0]%>"><%=lang[1]%></option>
                        </logic:iterate>
                        </select>
                  </logic:present>
                  <html:text property="title" />
                  </td>
            </tr>

            <tr bgcolor="#FFFFFF">
                  <td align="right"><trans:showPageMessage label="findsec.crscode" />:</td>
                  <td>
                  <html:text property="crs_code" />
                  </td>
            </tr>

            <!-- submitari -->
            <tr bgcolor="#f9f9f9">
                  <td align="center" colspan="2">
                  <input type="hidden" name="action" value="" />
                  <input type="button"
                        class="butonsave"
                        onclick="this.form.event.value='save';this.form.submit();"
                        value="<trans:showPageMessage label='<%="delete".equals(form.action) ? "sectors.delete" : "sectors.save"%>' hide_link="true" />" />
                  <input type="button"
                        class="butonsave"
                        onclick="javascript:window.close();"
                        value="<trans:showPageMessage label="sectors.cancel" hide_link="true" />" />
                  </td>
            </tr>
      </table><trans:showPageMessage label="translator.showhiddentags"/>
      </html:form>
      <% if ("delete".equals(form.action)) { %>
      <script language="javascript">
            document.forms[0].title.disabled=1;
            document.forms[0].lang.disabled=1;
            document.forms[0].crs_code.disabled=1;
      </script>
      <% } %>
</body>
</html:html>